import { Terminal } from '~/ui/components/Snippet';
import { Step } from '~/ui/components/Step';

import XcodeInstructions from './_xcodeInstructions.mdx';
import { BuildEnvironmentSwitch } from '../BuildEnvironmentSwitch';

## Set up an iOS device with a development build

<BuildEnvironmentSwitch />

## Set up Xcode and Watchman

<XcodeInstructions />

## Configure your project

<Step label="1">

### Install expo-dev-client

Run the following command in your project's root directory:

<Terminal cmd={['$ npx expo install expo-dev-client']} />

</Step>

<Step label="2">

### Plug in your device via USB and enable developer mode

1. Connect your iOS device to your Mac using a USB cable. Unlock the device and tap **Trust** if prompted.

2. Open Xcode. From the menu bar, select **Window** > **Devices and Simulators**. You will see a warning in Xcode to enable developer mode.

3. On your iOS device, open **Settings** > **Privacy & Security**, scroll down to the **Developer Mode** list item and navigate into it.

4. Tap the switch to enable **Developer Mode**. After you do so, Settings presents an alert to warn you that Developer Mode reduces your device's security. To continue enabling **Developer Mode**, tap the alert's **Restart** button.

5. After the device restarts and you unlock it, the device shows an alert confirming that you want to enable Developer Mode. Tap **Turn On**, and enter your device passcode when prompted.

</Step>

<Step label="3">

### Run the project on your device

1. Add the `ios.bundleIdentifier` in the **app.json** file in the root directory to a unique value so that Xcode generates the provisioning profile for the app signing step.

2. Run the following command in your project's root directory and select your plugged in device from the list:

<Terminal cmd={['$ npx expo run:ios --device']} />

> This command runs a development server after building your app. You can skip running `npx expo start` on the next page.

</Step>
